package com.jh.user.pojo.freeQuick;

import java.util.Objects;

import static com.google.common.base.Strings.isNullOrEmpty;

public enum  PayType {


    /**
     * 交易
     */
    TRADE("TRADE", "\u4ea4\u6613"),

    /**
     * 单笔提现费
     */
    WITHDRAW_SIGLE("WITHDRAW_SIGLE", "\u5355\u7b14\u63d0\u73b0\u8d39"),

    /**
     * 提现费率
     */
    WITHDRAW_RATE("WITHDRAW_RATE", "\u63d0\u73b0\u8d39\u7387"),

    ;

    private final String code;
    private final String value;

    PayType(String code, String value) {
        this.code = code;
        this.value = value;
    }

    public String getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }


    public static PayType of(String value) {
        if (isNullOrEmpty(value)) {
            return null;
        }
        for (PayType scc: values()) {
            if (Objects.equals(scc.getValue(), value)) {
                return scc;
            }
        }
        return null;
    }

    public static PayType code(String code) {
        if (isNullOrEmpty(code)) {
            return null;
        }
        for (PayType scc: values()) {
            if (Objects.equals(scc.getValue(), code)) {
                return scc;
            }
        }
        return null;
    }

}
